import React from 'react'

import { Routes, Route, Navigate } from 'react-router-dom'

// import Routes from './routes'


import Main from './components/main'
import Login from './components/Login'
import NotFind from './components/404'
import About from './components/main/About'
import Home from './components/main/Home'

export default function App() {
  return (
    <div>
      <Routes>
        <Route path='/login' element={<Login />} />

        {/* 二级路由
        1.二级路由必须有闭合标签
        2.当路径是'/Main/About',展示About的页面,
        */}
        <Route path='/Main' element={<Main />}>

          <Route path='/Main/About' element={<About />} />
          <Route path='/Main/Home' element={<Home />} />


        </Route>



        {/* 路由重定向 */}
        {/* 路由重定向1.Navigate 只要Navigate组件被解析,就会修改路径,切换视图到to的路径去
        2.*  其他所有非*的路由都解析过了也没有,就走*
        
        */}

        <Route path='/' element={<Navigate to={'/login'} />} />

        <Route path='*' element={<NotFind />} />

      </Routes>
    </div>
  )
}
